package com.jiazhong.listener;

import com.jiazhong.commons.util.DateUtil;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

//@WebListener
public class 会话对象创建销毁监听 implements HttpSessionListener {
    @Override
    public void sessionCreated(HttpSessionEvent e) {
        HttpSession session = e.getSession();
        // session.setMaxInactiveInterval(10);
        System.out.println(DateUtil.nowDate() + "创建了" + session.getId());
    }

    @Override
    public void sessionDestroyed(HttpSessionEvent e) {
        HttpSession session = e.getSession();
        System.out.println(DateUtil.nowDate() + "销毁了" + session.getId());
    }
}
